﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace XamarinToolKit
{
    public class Constants
    {
        public static string DataBasePath
        {
            get
            {
                return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "toolKit.db");
            }
        }

        public static async void DataBaseInitAsync(ToolKitContext context)
        {
            context.Database.EnsureCreated();
            if (!context.ToolKitMasters.Any())
            {
                await context.ToolKitMasters.AddRangeAsync(new Model.ToolKitMaster[] {
                    new Model.ToolKitMaster(){ GroupIcon = "\xe63b",  GroupName = "钱包",GroupDesc = "存储与金钱相关的账号和密码..."},
                    new Model.ToolKitMaster(){ GroupIcon = "\xe62f",  GroupName = "游戏",GroupDesc = "存储与游戏相关的账号和密码..."},
                    new Model.ToolKitMaster(){ GroupIcon = "\xe630",  GroupName = "社区",GroupDesc = "存储与社区相关的账号和密码..."},
                    new Model.ToolKitMaster(){ GroupIcon = "\xe61c",  GroupName = "企业",GroupDesc = "存储与企业相关的账号和密码..."},
                    new Model.ToolKitMaster(){ GroupIcon = "\xe61e",  GroupName = "其他",GroupDesc = "存储其他相关的账号和密码..."},
                });
                await context.SaveChangesAsync();
            }
        }
    }
}
